package com.lagou.serializer;

import com.alibaba.fastjson.JSON;

/**
 * @author 陶肖寅
 * @version V1.0
 * @Package com.lagou.serializer
 * @email fromlx@126.com
 * @date 2020-03-23 23:21
 * @Copyright © 2020-2021 城云科技(中国)有限公司
 */
public class JSONSerializer implements Serializer {
    @Override
    public byte[] serialize(Object object) {

        return JSON.toJSONBytes(object);

    }


    @Override
    public <T> T deserialize(Class<T> clazz, byte[] bytes) {

        return JSON.parseObject(bytes, clazz);

    }
}
